<!-- head -->
{include file='public/head' /}
<!-- head -->
<!-- left -->
{include file='public/left' /}
<!-- left -->

<div class="content-wrapper">
    <section class="content-header">
        <h1>
            修改店铺信息
            <small>店铺信息</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 店铺管理 </a></li>
            <li>店铺列表</li>
            <li class="active">修改</li>
        </ol>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">修改信息</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form name="form1" class="form-horizontal" method="post" action="{:url('admin/Store/editStore','','')}" enctype="multipart/form-data">
                        <input type="hidden" class="form-control" name="id" value="{$storedata.id}">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">店铺账号</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="admin_name" name="keeper_phone" value="{$storedata.keeper_phone}" placeholder="请输入账号..." readonly>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">店铺名称</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="admin_name" name="store_name" value="{$storedata.store_name}" placeholder="请输入账号...">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">店铺电话</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="admin_note" name="store_phone" value="{$storedata.store_phone}" placeholder="请输入名称...">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="img" class="col-sm-2 control-label">店铺地区</label>
                                <div class="col-sm-3">
                                    <select class="form-control select2" name="prov" id="prov" onChange="getCity()">
                                        <option selected="selected" value="{$storedata.prov}">请选择省份</option>
                                        {volist name='prov' id='prov'}
                                        <option value="{$prov.id}">{$prov.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="col-sm-3">
                                    <select class="form-control select2" name="city" id="city" onChange="getarea()">
                                        <option selected="selected" value="{$storedata.city}">请选择市</option>
                                    </select>
                                </div>
                                <div class="col-sm-3">
                                    <select class="form-control select2" name="area" id="area">
                                        <option selected="selected" value="{$storedata.area}">请选择县/区</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputPassword3" class="col-sm-2 control-label">详细地址</label>
                                <div class="input-group col-sm-10" style=" padding-left: 15px;">
                                    <input type="text" class="form-control" id="admin_note" style=" width: 91%" name="store_address" value="{$storedata.store_address}" placeholder="请输入名称...">
                                    <button type="button" class="btn btn-info btn-flat" onclick="javascrtpt:window.open('http://api.map.baidu.com/lbsapi/getpoint/index.html')">查询经纬度</button>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputPassword3" class="col-sm-2 control-label">经度</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="admin_note" name="longitude" value="{$storedata.longitude}" placeholder="请输入名称...">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputPassword3" class="col-sm-2 control-label">纬度</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="admin_not" name="latitude" value="{$storedata.latitude}" placeholder="请输入名称...">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputPassword3" class="col-sm-2 control-label">请输入你的密码</label>
                                <div class="col-sm-10">
                                    <input type="password" class="form-control" id="adminname" name="adminname" placeholder="安全验证：请输入你的密码">
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-info pull-right" name="submit" value="3">保存修改</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript">
    function getCity() {
        var options = $("#prov option:selected").val();  //获取选中的项
        $.ajax({
            url: "{:url('admin/Store/selectcity','','')}",
            type: 'GET',
            data: {
                'id': options,
            },
            dataType: 'JSON',
            success: function (data) {
                var arr = data;
                var dataObj = eval("(" + arr + ")");
                var data = dataObj.data;
                //var sltCity = document.form1.city;     //获得城市下拉框的对象  
                var obj = document.getElementById('city');
                obj.options.length = 1;
                for (var i = 0; i < data.length; i++) {
                    //sltCity[i + 1] = new Option(data[i]['name'], data[i]['name']);
                    $("#city").append("<option value='" + data[i]['id'] + "'>" + data[i]['name'] + "</option>");

                }
                console.log(data);
            }
        });
    }
    function getarea() {
        var options = $("#city option:selected").val();  //获取选中的项
        $.ajax({
            url: "{:url('admin/Store/selectarea','','')}",
            type: 'GET',
            data: {
                'id': options,
            },
            dataType: 'JSON',
            success: function (data) {
                var arr = data;
                var dataObj = eval("(" + arr + ")");
                var data = dataObj.data;
                //var sltCity = document.form1.city;     //获得城市下拉框的对象  
                var obj = document.getElementById('area');
                obj.options.length = 1;
                for (var i = 0; i < data.length; i++) {
                    //sltCity[i + 1] = new Option(data[i]['name'], data[i]['name']);
                    $("#area").append("<option value='" + data[i]['id'] + "'>" + data[i]['name'] + "</option>");
                }
                console.log(data);
            }
        });
    }
</script>  
<!-- foot -->
{include file='public/foot' /}
<!-- foot -->